#pragma once

#include <QObject>
//#include "XCompareThread.h"
#include "XTreeModel.h"
#include "XCompareDir.h"

class XDataManger :public QObject
{
	Q_OBJECT
	Q_PROPERTY(QString dirLeft READ dirLeft WRITE setDirLeft NOTIFY sigDirLeftChanged)
	Q_PROPERTY(QString dirRight READ dirRight WRITE setDirRight NOTIFY sigDirRightChanged)

public:
	explicit XDataManger(QObject * parent = nullptr);
	~XDataManger();

public:
	Q_INVOKABLE QString dirLeft();
	Q_INVOKABLE QString dirRight();
	Q_INVOKABLE void setDirLeft(QString dir);
	Q_INVOKABLE void setDirRight(QString dir);
	Q_INVOKABLE QAbstractItemModel * leftModel();
	Q_INVOKABLE QAbstractItemModel * rightModel();

public slots:
	void leftCompare(QString path);
	void rightCompare(QString path);
	void compare();
	void onCompareResult(QVariant data);
signals:
	void sigDirLeftChanged();
	void sigDirRightChanged();
	void sigDirChange(QString left, QString right);

private:
	QString m_strLeftDir;
	QString m_strRightDir;
	XTreeModel m_treeLeft;
	XTreeModel m_treeRight;
	//XCompareDir m_compare;
	//XCompareThread m_thread;
};

